//
//  CCYStatusCell.swift
//  03.微博
//
//  Created by 蔡承毅 on 16/9/30.
//  Copyright © 2016年 IOS. All rights reserved.
//

import UIKit

class CCYStatusCell: UITableViewCell {
    /// 微博头像
    @IBOutlet weak var iconView: UIImageView!
    /// 名字Label
    @IBOutlet weak var nameLabel: UILabel!
    /// 会员等级图片
    @IBOutlet weak var memberImageView: UIImageView!
    /// 认证类型view
    @IBOutlet weak var verifiedImageView: UIImageView!
    /// 来源label
    @IBOutlet weak var sourceLaebl: UILabel!
    /// 时间laebl
    @IBOutlet weak var timeLabel: UILabel!
    /// 微博内容label
    @IBOutlet weak var statusLabel: UILabel!
    /// 图片label
    @IBOutlet weak var pictureView: CCYStatusPictureView!
    
    var statusVM: CCYStatusVM?{
        didSet{
            guard let status = statusVM?.status else {
                print("没有微博模型")
                return
            }
            // 头像
            if let profile_image_url = status.user?.profile_image_url{
                let url = URL(string: profile_image_url)
                iconView.sd_setImage(with: url)
            }
            
            // 用户名称
            let name = status.user?.screen_name ?? "未知名称"
            nameLabel.text = name
            
            // 发送来源
            let source = status.source ?? "未知来源"
            sourceLaebl.text = source
            
            // 时间
            let time = status.created_at ?? "未知时间"
            timeLabel.text = time
            
            // 内容
            let text = status.text
            statusLabel.text = text
            
            memberImageView.image = statusVM?.vipImage
            
            verifiedImageView.image = statusVM?.verifiedImage

            pictureView.imageURLs = statusVM?.storePictureURLs
        }
    }
    
}
